Clarify comments. Add BASE_STRUCT.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 18 Jan 2004 21:34:44 +0000 (21:34 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 18 Jan 2004 21:34:44 +0000 (21:34 +0000)
gpsbabel/defs.h

index 59475c0663c1c805d490c8e31abd0c0122472293..c263c02f36260f1aa50e1ee4b706333546b9b6e5 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
+#include <stddef.h>
 #include "queue.h"
 
 
@@ -46,6 +47,8 @@
  * Common definitions.   There should be no protocol or file-specific
  * data in this file.
  */
+#define BASE_STRUCT(memberp, struct_type, member_name) \
+   ((struct_type *)((char *)(memberp) - offsetof(struct_type, member_name)))
 
 
 /*
@@ -121,7 +124,8 @@ typedef struct xml_tag {
  * way to the target.
  */
 typedef struct {
-       queue Q;
+       queue Q;                        /* Master waypoint q.  Not for use
+                                          by modules. */
 
        double latitude;                /* Degrees */
        double longitude;               /* Degrees */